package com.agileboot.attendance.domain.settlement.entity;

import com.agileboot.attendance.domain.settlement.enums.SettlementPeriodType;
import com.agileboot.attendance.domain.settlement.enums.SettlementStatus;
import com.agileboot.common.core.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 结算单实体
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("att_settlement")
public class AttSettlementEntity extends BaseEntity<AttSettlementEntity> {

    @TableId(value = "settlement_id", type = IdType.AUTO)
    private Long settlementId;

    /**
     * 结算单号
     */
    @TableField("settlement_code")
    private String billNo;

    /**
     * 项目ID
     */
    @TableField(exist = false)
    private Long projectId;

    /**
     * 订单ID
     */
    private Long orderId;

    /**
     * 供应商ID
     */
    private Long supplierId;

    /**
     * 验收单IDs（多个验收单ID以逗号分隔）
     */
    @TableField(exist = false)
    private String acceptanceIds;

    /**
     * 结算周期类型
     */
    @TableField(exist = false)
    private SettlementPeriodType periodType;

    /**
     * 结算开始日期
     */
    @TableField("period_start_date")
    private LocalDate startDate;

    /**
     * 结算结束日期
     */
    @TableField("period_end_date")
    private LocalDate endDate;

    /**
     * 结算总金额
     */
    private BigDecimal totalAmount;

    /**
     * 结算单状态
     */
    private SettlementStatus status;

    /**
     * 备注
     */
    private String remark;

    /**
     * 乙方审核人ID
     */
    @TableField(exist = false)
    private Long partyBApproveId;

    /**
     * 乙方审核人
     */
    @TableField("supplier_confirm_by")
    private String partyBApproveBy;

    /**
     * 乙方审核时间
     */
    @TableField("supplier_confirm_time")
    private LocalDateTime partyBApproveTime;

    /**
     * 乙方审核备注
     */
    @TableField(exist = false)
    private String partyBApproveRemark;

    /**
     * 甲方审核人ID
     */
    @TableField(exist = false)
    private Long partyAApproveId;

    /**
     * 甲方审核人
     */
    @TableField("customer_confirm_by")
    private String partyAApproveBy;

    /**
     * 甲方审核时间
     */
    @TableField("customer_confirm_time")
    private LocalDateTime partyAApproveTime;

    /**
     * 甲方审核备注
     */
    @TableField(exist = false)
    private String partyAApproveRemark;

    // 关联显示字段
    @TableField(exist = false)
    private String projectName;

    @TableField(exist = false)
    private String orderNo;

    @TableField(exist = false)
    private String supplierName;

    @TableField(exist = false)
    private String acceptanceNos;
    
    /**
     * 订单的结算周期
     */
    @TableField(exist = false)
    private String settlementCycle;
}
